for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
import {
Entity,
Column,
PrimaryGeneratedColumn,
ManyToOne,
UpdateDateColumn
} from 'typeorm';
import {Customer} from '../Customer/Customer.entity';
import {Project} from '../Project/Project.entity';
import {User} from '../User/User.entity';
@Entity()
export class Quote {
public static readonly STATUS_DRAFT = 'draft';
public static readonly STATUS_SENT = 'sent';
public static readonly STATUS_REFUSED = 'refused';
public static readonly STATUS_BILLED = 'billed';
@PrimaryGeneratedColumn('uuid')
private id: string;
@Column({type: 'varchar', nullable: false})
private status: string;
@Column({type: 'varchar', nullable: false, unique: true})
private quoteId: string;
@Column({type: 'timestamp', default: () => 'CURRENT_TIMESTAMP'})
private date: Date;
@UpdateDateColumn()
private expiryDate: Date;
@ManyToOne(type => User, {nullable: false})
private owner: User;
@ManyToOne(type => Customer, {nullable: false})
private customer: Customer;
@ManyToOne(type => Project, {nullable: true})
private project: Project;
constructor(
quoteId: string,
date: Date,
expiryDate: Date,
owner: User,
customer: Customer,
project?: Project | null
) {
this.quoteId = quoteId;
this.status = Quote.STATUS_DRAFT;
this.date = date;
this.expiryDate = expiryDate;
this.owner = owner;
this.customer = customer;
this.project = project;
}
public getId(): string {
return this.id;